x86/mm: avoid undefined behavior in IS_NIL()
authorXi Wang <xi@mit.edu>
Fri, 15 Mar 2013 09:26:17 +0000 (10:26 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 15 Mar 2013 09:26:17 +0000 (10:26 +0100)
commit50ae2d0cb625a5c122f27ee69fc2f81479eee33e
tree95dd5eafc9a6fe4ca2564cca36cfcca591c7587c
parent37d930430c2f2ef4dedf27deb404d2fe2602c039
x86/mm: avoid undefined behavior in IS_NIL()

Since pointer overflow is undefined behavior in C, some compilers such
as clang optimize away the check !((ptr) + 1) in the macro IS_NIL().

This patch fixes the issue by casting the pointer type to uintptr_t,
the operations of which are well-defined.

Signed-off-by: Xi Wang <xi@mit.edu>
With that, we also need to avoid the overflow in NIL().

Note that either part of the change results in the respective macros to
become unsuitable for use with "void".

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen/include/asm-x86/mm.h